<template>
  <div class="suggestion nav">
    <van-nav-bar title="留言" left-arrow @click-left="$router.history.go(-1)">
      <span slot='left' class="topleftIcon"><img src='../../../public/images/qt_75.png'/></span>
    </van-nav-bar>
    <div class="b_line ml-30 mr-30"></div>
    <textarea placeholder="说点什么吧" v-model='info.content'></textarea>
    <van-button class="mt-30 ml-30 mr-30" type="primary" size="large" @click='sure'>提交</van-button>
  </div>
</template>

<script>
import storage from '@/common/store'
export default {
  data(){
    return{
      commentActive:require('../../../public/images/commentActive.png'),
      comment:require('../../../public/images/comment.png'),
      info:{
        userId:storage.getItem('userInfo').userId,
        targetType:this.$route.query.targetType,
        targetId:this.$route.query.targetId
      }
    }
  },
  methods:{
    sure(){
      let that=this;
      if(!this.info.content){
         this.$toast.fail('请输入内容');
         return;
        
      };
      // if(this.$route.query.commentId){
      //   this.info.commentId=this.$route.query.commentId;
      // };
      this.$post(this.$api.blog.commentsPublish,this.info).then(data=>{
          this.$toast({message:'留言成功',duration:500,onClose:function(){
            that.$router.history.go(-1)
          }})
      })
    }
       
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
  .forms{background-color: #fff;}
  .forms .name{width: 1rem;height: 0.6rem;border-radius: 0.29rem;font: 0.28rem/0.6rem '微软雅黑';text-align: center;background-color: #F5F5F5;margin-right: 0.3rem;}
  .forms input[type=text]{border: none;outline: none;color: #CCCCCC;font: 0.3rem/0.9rem '微软雅黑';display: block;text-indent: 0.1rem;width: 100%;}
  .leftLine{position: relative;}
  .leftLine::before{content: '';width: 0.04rem;height: 0.4rem;background-color: #4AACE9;position: absolute;left: 0.3rem;top: 0.65rem;}
  textarea{font: 0.3rem/0.4rem '微软雅黑';color: #CCCCCC;border: none;outline: none;height: 2rem;padding: 0.43rem;width:calc(100vw - 0.86rem);display:block;}
  .pic{background-color: #fff;}
  .addPic{width: 1.8rem;height: 1.8rem;padding: 0.2rem 0;}
  .addPic img{width: 100%;height: 100%;display: inline-block;}
  input::-webkit-input-placeholder,textarea::-webkit-input-placeholder { /* WebKit browsers */
    color: #CCCCCC;
    font-size: 0.32rem;
  }

  input::-moz-placeholder,textarea::-webkit-input-placeholder { /* Mozilla Firefox 19+ */
    color: #CCCCCC;
    font-size: 0.32rem;
  }

  input::-ms-input-placeholder,textarea::-webkit-input-placeholder { /* Internet Explorer 10+ */
    color: #CCCCCC;
    font-size: 0.32rem;
  }   
  .txt{font-size:0.32rem;line-height: 0.92rem;color: #ccc;}
  .shopMessage{height: 1.2rem;background-color: #F5F5F5;}
  .shopMessage h1{font-size: 0.36rem;line-height:1.2rem;color: #333333;margin-left: 0.29rem;}
  .shopMessage img{width: 1.2rem;height: 1.2rem;}

  h2{font-size: 0.32rem;line-height: 0.76rem;color: #333;}
  .smalltxt{font-size: 0.24rem;color: #999;}
</style>
